A socket is an internal endpoint for sending and receiving data by a device in a network. A protocol stack enables processes to communicate via a network using sockets. A process can send and receive data via a socket using socket application programming interface (API) calls.